<template>
    <cfg-form-list slot="right">
        <cfg-title v-bind="config.title"></cfg-title>
        <cfg-form :only-read="onlyRead" v-bind="config.section.start" :data="data"></cfg-form>
        <cfg-subtitle :title="'相关数据:'"></cfg-subtitle>
        <cfg-form :only-read="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.relateData" :data="data.relateData"></cfg-form>
        <cfg-subtitle :title="'记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.records" :data="data.records"></cfg-sheet>
        <Button type="primary" long @click="data.records.push({})">加一行</Button>
        <cfg-subtitle :title="'备注:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" v-bind="config.section.comments" :data="data"></cfg-form>
    </cfg-form-list>
</template>

<script>
    export default {
        data () {
            return {
                onlyRead: false,
                config: {
                    title: {
                        title: '配 碳 原 始 记 录',
                        titleStyle: {},
                        outlineStyle: { marginBottom: '20px' }
                    },
                    section: {
                        start: {
                            labelWidth: 100,
                            labelPosition: 'right',
                            cols: 2,
                            columns: [
                                { title: '日期:', key: 'date', config: { type: 'date' } },
                                { title: '通知单单号:', key: 'noticeNo', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        relateData: {
                            labelWidth: 120,
                            labelPosition: 'right',
                            columns: [
                                { title: 'W+C批次:', key: 'batchNo', config: { type: 'text' } },
                                { title: '要求含C量(%):', key: 'requireC', config: { type: 'text' } }
                            ],
                            cols: 2,
                            rules: {}
                        },
                        records: {
                            columns: [
                                { title: '加入钨粉',
                                  align: 'center',
                                  children: [
                                      { title: '批号', align: 'center', key: 'wBatchNo', config: { type: 'text' } },
                                      { title: 'O<span style="font-size:12px;font-family:YouYuan">2</span>含量', align: 'center', key: 'O2', config: { type: 'number' } },
                                      { title: '重量（kg）', align: 'center', key: 'wWeight', config: { type: 'number' } }
                                  ]
                                },
                                { title: '加入炭黑',
                                  align: 'center',
                                  children: [
                                      { title: '批号', align: 'center', key: 'cBatchNo', config: { type: 'text' } },
                                      { title: '重量（kg）', align: 'center', key: 'cWeight', config: { type: 'number' } }
                                  ]
                                },
                                { title: '配碳机', align: 'center', key: 'carbonEquipment', config: { type: 'text' } },
                                { title: '混合时间',
                                  align: 'center',
                                  children: [
                                      { title: '开车时间', align: 'center', key: 'startTime', config: { type: 'time' } },
                                      { title: '停车时间', align: 'center', key: 'stopTime', config: { type: 'time' } }
                                  ]
                                },
                                { title: '总重量<br/>（kg）', align: 'center', key: 'weight', config: { type: 'text' } },
                                { title: '操作者',
                                  align: 'center',
                                  children: [
                                      { title: '进料', align: 'center', key: 'feedPerson', config: { type: 'text' } },
                                      { title: '卸料', align: 'center', key: 'onloadPerson', config: { type: 'text' } }
                                  ]
                                }

                            ]
                        },
                        comments: {
                            labelWidth: 0,
                            labelPosition: 'right',
                            cols: 1,
                            columns: [
                                { title: '', key: 'name', config: { type: 'textarea' } }
                            ],
                            rules: {}
                        }
                    }
                }
            };
        },
        props: {
            data: {
                default: () => {
                    return {
                        date: '',
                        noticeNo: '',
                        relateData: {
                            batchNo: '',
                            requireC: ''
                        },
                        records: [
                            {
                                wBatchNo: '',
                                O2: 0,
                                wWeight: 0,
                                cBatchNo: '',
                                cWeight: 0,
                                carbonEquipment: '',
                                startTime: '',
                                stopTime: '',
                                weight: '',
                                feedPerson: '',
                                onloadPerson: ''
                            }
                        ],
                        comments: ''
                    }
                }
            }
        }
    };
</script>
<style scoped lang="scss"></style>
